<!DOCTYPE html>
<html>
<head>
<title>Daftar Testimoni</title>
<link href="View/bootstrap/css/bootstrap.css" rel="stylesheet">
<link href="View/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
<link  href="View/bootstrap/js/bootstrap.min.js" rel="stylesheet"/>
<script type="text/javascript" src="View/bootstrap/js/jquery-latest.js"></script>
</head>
<?php
include_once '../model/testimoni.php';
session_start();
if (!isset($_SESSION["id_user"])){
	include '/content/content_header_guest.php';
} else {
	include '/content/content_header_user.php';
}
?>
<body>
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span9">
				<table class="table table-hover">
					<th><td><a href="form_testimoni.php"><i class="icon-plus"></a></td></th>
					<th>Nama Pengirim</th>
					<th>Judul</th>
					<th>Isi Testimoni</th>
					<th>Membernya</th>
					<th>&nbsp;</th>
					<?php 
					$testimoni = new ModelTestimoni();
					if (isset($_GET['delete'])) {
						$testimoni -> deleteTestimoni($_GET['delete']);
					}
					if (isset ($_GET['id_user'])) {
						$id = $_GET['id_user'];
						$testi2 = $testimoni-> getTestimoniUser($id);
						if (!empty($testi2))
						{
							foreach ($testi2 as $id_testimoni => $testi2)
							{
								echo 
								'<tr>
									<td><a href="../index.php?testimoni='.$testi2->id_user.'" class="btn" rel="tooltip" title="Detail"><i class="icon-arrow-right"></i></a></td>
									<td>'.$testi2->nama_pengirim.'</td>
									<td>'.$testi2->judultestimoni.'</td>
									<td>'.$testi2->isitestimoni.'</td>
									<td>'.$testi2->id_user.'</td>
									<td><a href="list_testimoni.php?delete='.$testi2->id_testimoni.'"><i class="icon-trash"></a></td>
								</tr>';
							}
						} else {
							echo 
								'<tr>
									<td></td>
									<td>tidak ada testimoni untuk member ini</td>
								</tr>';
						}
					} else {
						$testi2 = $testimoni-> getTestimoni();
						if (!empty($testi2))
						{
							foreach ($testi2 as $id_testimoni => $testi2)
							{
								echo 
								'<tr>
									<td><a href="../index.php?testimoni='.$testi2->id_user.'" class="btn" rel="tooltip" title="Detail"><i class="icon-arrow-right"></i></a></td>
									<td>'.$testi2->nama_pengirim.'</td>
									<td>'.$testi2->judultestimoni.'</td>
									<td>'.$testi2->isitestimoni.'</td>
									<td>'.$testi2->id_user.'</td>
									<td><a href="list_testimoni.php?delete='.$testi2->id_testimoni.'"><i class="icon-trash"></a></td>
								</tr>';
							}
						}
					}
					?>
				</table>
			</div>
			<div class="span3">
				<?php
					include 'list_produk_kategori.php';
				?>
				<?php
					include '/content/content_banner.php';
				?>
			</div>
		</div>
    </div>
</body>
<?php
include '/content/content_footer_site_map.php';
include '/content/content_footer.php';
?>